<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- <link rel="stylesheet" href="bt.css"> -->
</head>
<body>

    <input type="button" id="bt" value="发送验证码">

    <script>
        let button = document.querySelector("#bt");
        button.onclick = function() {
            // 点击以后立即获取当前时间
            let now = new Date().getTime();
            // 获取上一次发送验证码时间, 如果没有发送则设置为0
            let lastSentTime = parseInt(localStorage.getItem('lastSentTime') || '0');

            // 判断发送时间
            if(now - lastSentTime < 60 * 1000) {
                alert("请一分钟后重试!")
            }else {
                // 可以重新发送以后, 重新设置定时器
                localStorage.setItem('lastSentTime', now.toString());
            }
        }

    </script>
</body>
</html>